package org.javaboy.vhr.service;

import org.javaboy.vhr.mapper.RecruitMapper;
import org.javaboy.vhr.model.Employee;
import org.javaboy.vhr.model.Recruit;
import org.javaboy.vhr.model.RespPageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RecruitService {

    @Autowired
    RecruitMapper recruitMapper;

    public List<Recruit> getAllRecruit() {
        return recruitMapper.getAllRecruit();
    }

    public int addRecruit(Recruit recruit) {
        recruit.setStatus(0);
        return recruitMapper.addRecruit(recruit);
    }
    public RespPageBean getRecruit_0(Integer page, Integer size, Integer status_id) {
        if (page != null && size != null) {
            page = (page - 1) * size;
        }
        List<Recruit> data = recruitMapper.getRecruit_0(page, size,status_id);
        long total =recruitMapper.getTotal(status_id);
        RespPageBean bean = new RespPageBean();
        bean.setData(data);
        bean.setTotal(total);
        return bean;
    }
}
